local S = minetest.get_translator("default")

local recipes = {
    {"farming:mint_leaf 3", tf_recipes.glass.." 4","bucket:bucket_water","farming:mint_tea 4","bucket:bucket_empty",4},
    {"farming:coffee_beans", tf_recipes.glass.." 4","bucket:bucket_water","farming:coffee_cup 4","bucket:bucket_empty",4},
    {"farming:coffee_beans", tf_recipes.glass.." 4","default:ice","farming:coffee_cup 4","bucket:bucket_empty",4},
    {"farming:coffee_beans", tf_recipes.glass.." 4","mobs:bucket_milk","tf_recipes:cappuccino 4","bucket:bucket_empty",4},
    {"farming:coffee_beans", tf_recipes.glass.." 4","tf_recipes:grain_milk 4","tf_recipes:cappuccino 4","bucket:bucket_empty",4},
    {"farming:coffee_beans", tf_recipes.glass.." 4","farming:soy_milk 4","tf_recipes:cappuccino 4","vessels:drinking_glass",4},
    {"farming:cocoa_beans", tf_recipes.glass.." 4","bucket:bucket_water","tf_recipes:cocoa_cup 4","bucket:bucket_empty",4},
    {"ethereal:lemon", tf_recipes.glass.." 4","bucket:bucket_water","tf_recipes:hot_lemon 4","bucket:bucket_empty",4},
    {"farming:barley 8", tf_recipes.glass.." 4","bucket:bucket_water","tf_recipes:grain_milk 4","bucket:bucket_empty",4},
    {"farming:oat 8", tf_recipes.glass.." 4","bucket:bucket_water","tf_recipes:grain_milk 4","bucket:bucket_empty",4},
    {"farming:rye 8", tf_recipes.glass.." 4","bucket:bucket_water","tf_recipes:grain_milk 4","bucket:bucket_empty",4},
    {"farming:wheat 8", tf_recipes.glass.." 4","bucket:bucket_water","tf_recipes:grain_milk 4","bucket:bucket_empty",4},
    {"farming:oat 4", tf_recipes.bowl,tf_recipes.glasswater,"farming:porridge",tf_recipes.glass,4},
}

-- register recipes
for _, data in pairs(recipes) do
    local boil_time = data[6] or 1
    local b_registered = true
    for i=1,5 do
        if data[i] then
            local item_name = string.split(data[i],' ')[1]
            b_registered = b_registered and (minetest.registered_items[item_name] ~= nil)
        else
            print(dump(data[i]))
            b_registered = false
        end
    end
    if b_registered then
    	tf_coffee.register_brewing_recipe({input = {data[1], data[2], data[3]}, output = {data[4],data[5]}, time = boil_time})
    end
end
